import axios from 'axios'
import NProcess from 'nprogress'
import 'nprogress/nprogress.css'

axios.interceptors.request.use(config => {
    NProcess.start()

    let appkey = window.sessionStorage.getItem('appkey')
    if (!appkey) {
        appkey = 'demo13_1545210570249'
        window.sessionStorage.setItem('appkey', appkey)
    }

    config.url += `?appkey=${appkey}`
    // console.log(config);
    return config
})

axios.interceptors.response.use(res => {
    NProcess.done()
	if(res.status===200){
		return res.data 
	}
})

export default axios
